package uitest 
{
	import flash.utils.Proxy;
	import flash.utils.flash_proxy;
	public dynamic class WO extends Proxy {;
				private var _obj:*;
				private var _watchHashTable:Object;
				/**//**Constructor WO
				*
				* @param obj:* 对象
				*
				**/
				public function WO(obj:*) {
				  _watchHashTable={};
				  _obj=obj;
				}
				/**//**Public function watch
				*
				* @param prop:String 属性
				* @param callBackFunc:Function 回调函数
				* @param arg:*=null 可选参数
				*
				**/
				public function watch(prop:String,callBackFunc:Function,arg:*=null):void {
				  _watchHashTable[prop]={};
				  _watchHashTable[prop].prop=prop;
				  _watchHashTable[prop].oldV=flash_proxy::getProperty(prop);
				  _watchHashTable[prop].newV=null;
				  _watchHashTable[prop].callBackFunc=callBackFunc;
				  _watchHashTable[prop].arg=arg;
				}
				
		/*		override flash_proxy function callProperty(methodName:*, args):* 
				{
					 return _obj[methodName].apply(_obj,args);
				}*/
		/*		override flash_proxy function callProperty(methodName:*,  args):* {
				 
				}*/
				override flash_proxy function getProperty(name:*):* {
				  //trace("getProperty");
				  return _obj[name];
				}
				override flash_proxy function setProperty(name:*, value:*):void {
				  //trace("setProperty");
				  if (_watchHashTable[name]!=undefined && value!=_watchHashTable[name].oldV) {
				   _watchHashTable[name].newV=value;
				   _watchHashTable[name].oldV=_watchHashTable[name].callBackFunc.apply(null,[_watchHashTable[name].prop,_watchHashTable[name].oldV,_watchHashTable[name].newV,_watchHashTable[name].arg]);
				  }
				  _obj[name] = value;
				}
	}

}